import { dealValueIsRight } from '@/pages/commodity/modules/utils/salePriceRequireUtils'
import { generateHighlightNodeForSalePrice } from '@/utils/bizUtils';
export const salePriceSingleColumns = [
  {
    title: 'SKU编码',
    key: 'skuNo',
    fixed: 'left'
  },
  {
    title: '商品名称',
    key: 'productName',
    fixed: 'left',
  },
  {
    title: '规格',
    key: 'spec',
    fixed: 'left',
  },
  {
    title: '价格组',
    key: 'groupName',
    fixed: 'left',
  },
  {
    title: '城市',
    key: 'cityName',
  },
  {
    title: '业务区域',
    key: 'businessArea',
  },
  {
    title: '是否敏感',
    key: 'isPriceSensitive',
    formatter: (row, columns, cellValue) => {
      return cellValue === '1' ? '是' : '否';
    },
  },
  {
    title: '商品管理区域',
    key: 'saleAreaName',
  },
  {
    title: '供货计量单位',
    key: 'supplyUnit',
  },
  {
    title: '主计量单位',
    key: 'mainUnit',
  },
  {
    title: '售价类型',
    key: 'saleTypeName',
    render: (h, { row }) => {
      let saleTypeStr = row.nowInput.saleType === '1' ? '统一售价' : '区域售价'
      return (<span>{ saleTypeStr }</span>)
    },
  },
  {
    title: '成本价',
    children: [{
      title: '原值',
      key: 'oldMainUnitPrice',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.mainUnitPrice) }</span>)
      }
    },
    {
      title: '现值',
      key: 'nowMainUnitPrice',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitPrice, row.nowInput.mainUnitPrice)
      }
    }]
  },
  {
    title: '销售面价',
    children: [{
      title: '原值',
      key: 'oldFacePrice2',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.facePrice2) }</span>)
      }
    },
    {
      title: '现值',
      key: 'facePrice2',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.facePrice2, row.nowInput.facePrice2)
      }
    }]
  },
  {
    title: '加价类型',
    children: [{
      title: '原值',
      key: 'oldAddPriceTypeName',
      render: (h, { row }) => {
        return (<span>{ row.oldInput.addPriceTypeName }</span>)
      }
    },
    {
      title: '现值',
      key: 'nowAddPriceTypeName',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.addPriceTypeName, row.nowInput.addPriceTypeName)
      }
    }]
  },
  {
    title: '现金价标准加价率/金额',
    children: [{
      title: '原值',
      key: 'oldcashAddRateOrMoney',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.cashAddRateOrMoney) }</span>)
      }
    },
    {
      title: '现值',
      key: 'cashAddRateOrMoney',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.cashAddRateOrMoney, row.nowInput.cashAddRateOrMoney)
      }
    }]
  },
  {
    title: '现金价',
    children: [{
      title: '原值',
      key: 'oldCashPrice',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.cashPrice) }</span>)
      }
    },
    {
      title: '现值',
      key: 'cashPrice',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.cashPrice, row.nowInput.cashPrice)
      }
    },
    {
      title: '浮动率',
      key: 'cashFloatRate',
    }]
  },
  {
    title: '现金实时加价率',
    children: [{
      title: '原值',
      key: 'oldRealCashPriceAddRate',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.realCashPriceAddRate) }</span>)
      }
    },
    {
      title: '现值',
      key: 'nowRealCashPriceAddRate',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.realCashPriceAddRate, row.nowInput.realCashPriceAddRate)
      }
    }]
  },
  {
    title: '费用利润比',
    render: (h, { row }) => {
      return (<span>{ dealValueIsRight(row.nowInput.profit) }</span>)
    }
  },
  {
    title: '分销与现金差额/差率',
    children: [{
      title: '原值',
      key: 'oldDistribCashDiffRateOrMoney',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.distribCashDiffRateOrMoney) }</span>)
      }
    },
    {
      title: '现值',
      key: 'distribCashDiffRateOrMoney',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.distribCashDiffRateOrMoney, row.nowInput.distribCashDiffRateOrMoney)
      }
    }]
  },
  {
    title: '分销价',
    children: [{
      title: '原值',
      key: 'oldcashDistribMoney',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.cashDistribMoney) }</span>)
      }
    },
    {
      title: '现值',
      key: 'cashDistribMoney',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.cashDistribMoney, row.nowInput.cashDistribMoney)
      }
    },
    {
      title: '浮动率',
      key: 'distribFloatRate',
    }]
  },
  {
    title: '分销实时价加价率',
    children: [{
      title: '原值',
      key: 'oldRealDistribPriceAddRate',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.realDistribPriceAddRate) }</span>)
      }
    },
    {
      title: '现值',
      key: 'nowRealDistribPriceAddRate',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.realDistribPriceAddRate, row.nowInput.realDistribPriceAddRate)
      }
    }]
  },
  {
    title: '售价标准加价率/金额',
    children: [{
      title: '原值',
      key: 'oldSaleAddRateOrMoney',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.saleAddRateOrMoney) }</span>)
      }
    },
    {
      title: '现值',
      key: 'saleAddRateOrMoney',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.saleAddRateOrMoney, row.nowInput.saleAddRateOrMoney)
      }
    }]
  },
  {
    title: '售价',
    children: [{
      title: '原值',
      key: 'oldsalePrice',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.salePrice) }</span>)
      }
    },
    {
      title: '现值',
      key: 'salePrice',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.salePrice, row.nowInput.salePrice)
      }
    },
    {
      title: '浮动率',
      key: 'saleFloatRate',
    }]
  },
  {
    title: '售价实时加价率',
    children: [{
      title: '原值',
      key: 'oldRealSalePriceAddRate',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.realSalePriceAddRate) }</span>)
      }
    },
    {
      title: '现值',
      key: 'nowRealSalePriceAddRate',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.realSalePriceAddRate, row.nowInput.realSalePriceAddRate)
      }
    }]
  },
  {
    title: '限制展示价',
    children: [{
      title: '原值',
      key: 'oldlimitShowPrice',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.limitShowPrice) }</span>)
      }
    },
    {
      title: '现值',
      key: 'limitShowPrice',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.limitShowPrice, row.nowInput.limitShowPrice)
      }
    }]
  },
  {
    title: '限制交易价',
    children: [{
      title: '原值',
      key: 'oldlimitTradePrice',
      render: (h, { row }) => {
        return (<span>{ dealValueIsRight(row.oldInput.limitTradePrice) }</span>)
      }
    },
    {
      title: '现值',
      key: 'limitTradePrice',
      render: (h, { row }) => {
        return generateHighlightNodeForSalePrice(h, row.oldInput.limitTradePrice, row.nowInput.limitTradePrice)
      }
    }]
  }
]
